package Demo4;

public class Test {
    //只要实现IRunning接口的都能是实现
    public static void walk(IRunning running){
        running.run();
    }
    public static void swim(ISwimming swimming){
        swimming.swim();
    }
    public static void main(String[] args) {

        walk(new Dog("旺财"));//发生向上转型
        walk(new Duck("唐老鸭"));
    }
}
